;
; ------------------------------------------------------------
;
;   PureBasic - n3xt-D 1.0 version
;
;    (c) 2009 - www.PureBasic3D.com
;
; revision 001 date: 08-mars-09 by TMyke
; ------------------------------------------------------------
;
; 
;

IncludeFile "n3xtD_Constantes.pbi"
IncludeFile "n3xtD_Math.pbi"
IncludeFile "n3xtD_Vector2.pbi"
IncludeFile "n3xtD_Vector3.pbi"
IncludeFile "n3xtD_Plan.pbi"
IncludeFile "n3xtD_Matrix.pbi"
IncludeFile "n3xtD_AABB.pbi"
IncludeFile "n3xtD_Structure.pbi"




CompilerIf #PB_Compiler_OS = #PB_OS_Linux
  ; link OpenGL
  ImportC "-lGL"
  EndImport
  ;link Xf86
  ImportC "-lXxf86vm"
  EndImport
  ; link X11
  ImportC "-lX11"
  EndImport
  ; Newton
  ImportC "-lNewton"
  EndImport
  ; 
  ImportC "-lstdc++"
  EndImport  ;
  ;
  ImportC "-lN3xtD"
  ;
CompilerEndIf                                                


CompilerIf #PB_Compiler_OS = #PB_OS_Windows
  ImportC "n3xtD.lib"
CompilerEndIf




; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- Global application v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iSetAntiAlias( value=#False)
iSetInputEvent( value = #False)
iInitEngine()
iCreateScreen(dType.l, dwWidth.l, dwHeight.l, VSync.b=#True, Depth.l=32, fullscreen.b=#False, stencil.c=#True, physic.b=#True)
iCreateEngineGadget(hWnd.l, dType.l, dwWidth.l, dwHeight.l, VSync.b=#True, stencil.c=#False, physic.b=#True)
iFreeEngine()
iBeginScene.l( red.c=0,  green.c=0,  blue.c =0, alpha.c=255, backbuffer.b=#True,  zbuffer.b=#True)
iDrawScene()
iDrawGUI()
iEndScene()
iSendLog(logtext.s)
iLogFile(flag.l=#True)
iFPS.l()
iRenderTarget.l( *target.ITexture , clearBackBuffer.b=#True,  clearZBuffe.b=#True,  color.l=0)
iSetViewPort( x.l,  y.l,  dx.l,  dy.l )
iTextureCreation( flag.l, enabled.b )
iClipPlane.l(index.l, *iplane.iPLANE, enable.b=#True)
iEnableClipPlane(index.l,  enable.b=#True)
iGetProjectionTransform(*mat.iMATRIX)
iGetViewTransform(*mat.iMATRIX)
iGetWorldTransform(*mat.l)
iQueryFeature( feature.l )
iRegisterNodeForRendering( *node.INode , pass.l )
iFog( color.l=$00ffffff, FogType.l=#EFT_FOG_LINEAR,  start.f=50.0, FEnd.f=100.0,  density.f=0.01,  pixelFog.b=#False,  rangeFog.b=#False )
iShadowColor( color.l=$96000000)
iDistanceLOD(  d0.f,  d1.f,  d2.f,  d3.f,  d4.f,  d5.f)
iCreateSceneManager.l()
iCurentSceneManager.l(*scenemanager.l)
iDrawSceneManager(*smgr0.l)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- NODE Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iPositionNode(*node.INode,  x.f,  y.f,  z.f)
iXNode(*node.INode,  x.f)
iYNode(*node.INode,  y.f)
iZNode(*node.INode,  z.f)
iRotateNode(*node.INode, x.f,  y.f,  z.f)
iScaleNode(*node.INode, x.f,  y.f,  z.f)
iTurnNode(*node.INode, x.f,  y.f,  z.f)
iTranslateNode(*node.INode, x.f,  y.f,  z.f)
iMoveNode(*node.INode, x.f,  y.f,  z.f)
iAddChildNode(*node.INode, *child.INode)
iCloneNode.l(*node.INode, *parent.INode=#Null)  ; return *INode
iNodePosition(*node.INode, *vect.iVECTOR3)
iNodePositionP(*node.INode, *vect.iVECTOR3)
iNodeRotation(*node.INode, *vect.iVECTOR3)
iNodeAbsoluteRotation(*node.INode, *vect.iVECTOR3)
iNodeScale(*node.INode, *vect.iVECTOR3)
iNodeX.f(*node.INode)
iNodeY.f(*node.INode)
iNodeZ.f(*node.INode)
iNodeTransformation(*node.INode, *mat.iMATRIX)
iNodeChildren.l(*node.INode, num.l=0) ; return *INode
iNodeFindChildren.l(*node.INode, *child.INode) ; return bool
iNodeNumChildren.l(*node.INode)
iNodeNumMaterial.l(*node.INode)
iNodeMaterial.l(*node.INode,  num.l=0)
iMaterialNode(*node.INode, *mat.IMaterial, num.l=0)
iNodeParent.l(*node.INode)
iNodeBoundingBox(*node.INode,  *box.AABBOX)
iNodeTransformedBoundingBox(*node.INode,  *box.AABBOX)
iNodeType.l(*node.INode)
iNodeVisible.l(*node.INode)
iNodeName.l(*node.INode)
iNodeNametype.l(*node.INode)
iVisibleNode(*node.INode,  flag.b=#True)
iNodeBoxIsVisible.l(*node.INode, *cam.ICamera)
iFreeNode(*node.INode)
iFreeAllChildrenNode(*node.INode)
iFreeChildrenNode(*node.INode, *child.INode)
iRenderNode(*node.INode)
iDebugModeNode(*node.INode,  state.l)
iMaterialFlagNode(*node.INode,  Flag.l,  newvalue.b=#True)
iMaterialTextureNode(*node.INode, *texture.ITexture , Layer.l=0)
iParentNode(*node.INode, *parent.INode)
iUpdateAbsolutePositionNode(*node.INode)
iSpecularColorNode(*node.INode, color.l)
iAmbientColorNode(*node.INode, color.l)
iDiffuseColorNode(*node.INode, color.l)
iEmissiveColorNode(*node.INode, color.l)
iShininessColorNode(*node.INode, shin.f=20.0)
iGlobalColorNode(*node.INode, color.l)
iLoadTextureNode.l(*node.INode, filename.s, num.l=0,  layer.l=0) ; return ITexture*  
iProjectedX.l(*node.INode, *camera.ICamera=#Null)
iProjectedY.l(*node.INode, *camera.ICamera=#Null)
iMaterialTypeNode(*node.INode,  type.l )
iPointNode(*node.INode, *target.INode,  roll.f=0)
iPointTargetNode(*node.INode, px.f=0, py.f=0, pz.f=0,  roll.f=0)
iTurnAirNode(*node.INode, px.f=0, py.f=0, pz.f=0)
iAutomaticCullingNode(state.l=#EAC_BOX  )
iNodeRootScene.l()
iNodeDirection(*node.INode, *vect.iVECTOR3)
iPickingNode(*node.INode,  pickFlag.l=#True)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- Object Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iLoad3DObject.l(filename.s) ; return *IObjet
iObjectGeometry(*object.IObject, frame.l=0, detail.l=0, startFrameloop.l=-1,  endFrameLoop.l=-1)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- COLLIDE Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iOverPickCamera.l(*camera.ICamera)
iPickCamera.l(*camera.ICamera, mx.l,  my.l, pickType.l=#ENT_PICKBOX, distance.f=5000.0 )
iCollisionPoint.l(sx.f, sy.f, sz.f, ex.f, ey.f, ez.f, *mesh.IMesh)
iCollisionPointNode.l(sx.f, sy.f, sz.f, ex.f, ey.f, ez.f, pickType.l=#ENT_PICKBOX)

iPickedPosition(*pos.f)
iPickedNormal(*norm.f)
iPickedtriangle(*triangles.f)

iCreateCollisionResponseAnimator.l(*world.IMesh, *Node.INode, elRadiusX.f, elRadiusY.f, elRadiusZ.f, elTransX.f=0, elTransY.f=0, elTransZ.f=0, gravityPerSecondX.f=0, gravityPerSecondY.f=-10, gravityPerSecondZ.f=0, slidingValue.f=0.0005)
iAddCollisionResponse(*node.INode, *anim.IAnimatorCollisionResponse)
iCollisionResponseEllipsoidRadius(*anim.IAnimatorCollisionResponse, *radius.f)
iCollisionResponseEllipsoidTranslation(*anim.IAnimatorCollisionResponse, *Translation.f)
iCollisionResponseGravity(*anim.IAnimatorCollisionResponse, *gravity.f)
iCollisionResponseFalling.l(*anim.IAnimatorCollisionResponse)
iJumpCollisionResponse(*anim.IAnimatorCollisionResponse,  jumpSpeed.f)
iEllipsoidRadiusCollisionResponse(*anim.IAnimatorCollisionResponse,  x.f,  y.f,  z.f)
iEllipsoidTranslationCollisionResponse(*anim.IAnimatorCollisionResponse,  x.f,  y.f,  z.f)
iGravityCollisionResponse(*anim.IAnimatorCollisionResponse,  x.f,  y.f,  z.f)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- OCTREE  Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iSetPolysPerNode(num.l=256)
iCreateMeshInOctree.l(*model.IObject,  *parent.l=#Null, frame.l=0, detail.l=0, startFrameloop.l=-1, endFrameLoop.l=-1) ; return *IMesh


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- TIMER  Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iGetTime.l()
iGetRealTime.l()
iGetSpeed.f()
iIsStopped.l()
iSetSpeed( speed.f =1.0)
iSetTime( tt.l )
iStartTime()
iStoptTime()
iTickTime()

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- MESH Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateMesh.l(*model.IObject,  *parent.l=#Null, frame.l=0, detail.l=0, startFrameloop.l=-1, endFrameLoop.l=-1) ; return *IMesh
iCreateCube.l( ssize.f=1.0, *parent.l=#Null) ; return *INode
iCreateSphere.l(radius.f=1.0,  polyCount.l=16, *parent.l=#Null) ; return *INode
iCreateEmptyMesh.l(*parent.l=#Null)
iCreateCylinder.l(radius.f=1.0, length.f=5.0, color.l=$ffffffff, tesselation.l=8, closeTop.b=#True,  oblique.f=0, *parent.l=#Null)
iCreateCone.l(radius.f=1.0, length.f=5.0, colorTop.l=$ffffffff, colorBottom.l=$ffffffff, tesselation.l=8,  oblique.f=0, *parent.l=#Null)
iCreateArrow.l(tesselationCylinder.l=4, tesselationCone.l=8, height.f=1.0, cylinderHeight.f=0.6, width0.f=0.05, width1.f=0.3, vtxColor0.l=$ffffffff, vtxColor1.l=$ffffffff , *parent.l=#Null)
iCreateHillPlane(tileSizeW.f=10.0, tileSizeH.f=10.0, tileCountW.l=10, tileCountH.l=10, *material.IMaterial=#Null,	 hillHeight.f=0, countHillsW.f=0, countHillsH.f=0, textureRepeatCountW.f=1, textureRepeatCountH.f=1,	*parent.l=#Null)
iCreateText.l(*font.IGUIFont, text.s,	color.l=$ffffffff, *parent.l=#Null)
iCreateMeshCopy.l(*mesh.IMesh)
iCloneMesh.l(*mesh.IMesh)
iCreateMeshWithTangents.l(*mesh.IMesh,  recalculateNormals.b=#False,  smooth.b=#False,  angleWeighted.b=#False)
iCreateMeshWith2TCoords.l(*mesh.IMesh)
iMeshGeometry.l(*mesh.IMesh)
iDrawIndexedTriangleList(*vertices.l, vertexCount.l, *indexList.w,  triangleCount.l)
iDrawIndexedTriangleList2T(*vertices.l, vertexCount.l, *indexList.w,  triangleCount.l)
iDrawIndexedTriangleListTan(*vertices.l, vertexCount.l, *indexList.w,  triangleCount.l)
; 
iAddBufferMesh(*mesh.IMesh,  vertex_type.l=#EVT_STANDART)
iAddVertexMesh.l(*mesh.IMesh,  x.f,  y.f,  z.f, color.l=$ffffffff,  u.f=0,  v.f=0 ,  num_buffer.l=0)
iAddFaceMesh.l(*mesh.IMesh,  p1.l,  p2.l,  p3.l , num_buffer.l=0)
iAddCVertexMesh.l(*mesh.IMesh, *buf.l , num_buffer.l=0)
iAddMVerticesMesh(*mesh.IMesh, *buf.l,  numVert.l, num_buffer.l=0)
iAddMFacesMesh(*mesh.IMesh, *id.l,  numId.l, num_buffer.l=0)
; geometry instructions change
iMeshBufferNumBuffer.l(*mesh.IMeshBuffer)
iMeshBufferVertexType.l(*mesh.IMeshBuffer,  num_buffer.l=0)
iFlipSurfacesMeshBuffer(*mesh.IMeshBuffer )
iVertexColorAlphaMeshBuffer(*mesh.IMeshBuffer,  alpha.l)
iCalculateNormalsMeshBuffer(*mesh.IMeshBuffer,  smooth.b=#False,  angleWeighted.b=#False)
iTransformMeshBuffer(*mesh.IMeshBuffer, *mat.iMATRIX)
iScaleMeshBuffer(*mesh.IMeshBuffer, factorx.f, factory.f, factorz.f)
iRotateMeshBuffer(*mesh.IMeshBuffer, rotx.f, roty.f, rotz.f)
iTranslateMeshBuffer(*mesh.IMeshBuffer, tx.f, ty.f, tz.f)
iScaleTCoordsMeshBuffer(*mesh.IMeshBuffer, factorx.f, factory.f, layer.l=0)
iPlanarTextureMappingMeshBuffer(*mesh.IMeshBuffer,  resolution.f=0.01 )
iHardwareMapMeshBuffer(*mesh.IMeshBuffer, NewMappingHint.l=#EHM_STATIC)
iDirtyMeshBuffer(*mesh.IMeshBuffer,  BufferType.l=#EBT_VERTEX_AND_INDEX)
iMeshBuffer.l(*mesh.IMeshBuffer,  num_buffer.l=0)
iMeshBufferNumVertex.l(*mesh.IMeshBuffer,  num_buffer.l=0)
iMeshBufferVertex(*mesh.IMeshBuffer, *vert.iVECTOR3,  num_vert.l=0, num_buffer.l=0)
iVertexMeshBuffer(*mesh.IMeshBuffer, x.f ,y.f ,z.f,  num_vert.l=0, num_buffer.l=0)
iMeshBufferNormal(*mesh.IMeshBuffer, *norm.iVECTOR3,  num_vert.l=0, num_buffer.l=0)
iNormalMeshBuffer(*mesh.IMeshBuffer, x.f ,y.f ,z.f,  num_vert.l=0, num_buffer.l=0)
iVertexColorMeshBuffer(*mesh.IMeshBuffer, color.l,  num_vert.l=0, num_buffer.l=0)
iMeshBufferTexCoord(*mesh.IMeshBuffer, *tex.iVECTOR2,  num_vert.l=0, num_buffer.l=0)
iTexCoordMeshBuffer(*mesh.IMeshBuffer, u.f, v.f,  num_vert.l=0, num_buffer.l=0)
iMeshBufferTexCoord2(*mesh.IMeshBuffer, *tex.iVECTOR2,  num_vert.l=0, num_buffer.l=0)
iTexCoord2MeshBuffer(*mesh.IMeshBuffer, u.f, v.f,  num_vert.l=0, num_buffer.l=0)
iMeshBufferVerticesBuffer.l(*mesh.IMeshBuffer, num_buffer.l=0)
iMeshBufferVertexColor(*mesh.IMeshBuffer, *color.l,  num_vert.l=0, num_buffer.l=0)
iMeshBufferIndicesBuffer.l(*mesh.IMeshBuffer, num_buffer.l=0)
iMeshBufferFace(*mesh.IMeshBuffer, numface.l, *v0.w, *v1.w, *v2.w, num_buffer.l=0)
iMeshBufferPolyCount.l(*mesh.IMeshBuffer,  num_buffer.l=0)
iMeshBufferGetVertex(*mesh.IMeshBuffer, *vert.l, num_vert.l, num_buffer.l=0)
iCalculBoundingBoxMeshBuffer(*mesh.IMeshBuffer)
iBoundingBoxMeshBuffer(*mesh.IMeshBuffer, *min.iVECTOR3, *max.iVECTOR3)
iVertexMemoryMeshBuffer(*mesh.IMeshBuffer, *vertices.l, startVert.l, endVert.l, num_buffer.l=0)
iFaceMemoryMeshBuffer(*mesh.IMeshBuffer, *indice.l, startVert.l, endVert.l, num_buffer.l=0)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- IRRSCENE Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iLoadIrrScene(filename.s, *userDataSerializer.l=#Null)
iSaveIrrScene(filename.s, *userDataSerializer.l=#Null)
iSceneNodesFromType(*arr.IArray, type.l=#ESNT_ANY, *start.INode=#Null)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- LOD Mesh Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateLOD.l( *parent=#Null)
iAddMeshLOD.l( *lod.l,  index.l, *node.INode)
iSetMeshLOD( *lod.l,  *node1.INode, *node2.INode, *node3.INode, *node4.INode, *node5.INode, *node6.INode)
iLODCurent.l( *lod.l)
iLODSceneNode( *lod.l,  index.l=0)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- SPRITE3D Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateSprite3D.l( texturename.s, ssize.f=1.0, color.l=$ffffffff, *parent.l=#Null) ; return ISpriteSceneNode
iOrientationSprite3D(*sp.ISpriteSceneNode, Orientation.l=0)
iCenterSprite3D(*sp.ISpriteSceneNode,  x.f=0,  y.f=0,  z.f=0) 



; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- PIVOT Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreatePivot.l(*parent.l=#Null)



; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- SKY/BOLT/WATER Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateSkybox.l(*top.ITexture,*bottom.ITexture,	*left.ITexture,	*right.ITexture,*front.ITexture,*back.ITexture, *parent.l=#Null)
iSkyboxVerticesZone.l( *sky.IMesh)
iCreateSkydome.l(*texture.ITexture, horiRes.l=16, vertRes.l=8, texturePercentage.f=0.9,  spherePercentage.f=2.0, radius.f=1000.0, *parent.l=#Null)
iCreateBolt.l(filename.s, startx.f,  starty.f, startz.f, endx.f,  endy.f,  endz.f,  updateTime.l=300,  height.l=10,  parts.l=10,  bolts.l=1,  steddyend.b=#True,  thick.f=5.0,  col.l=$ffff0000, *parent.l=#Null)  ; return IBolt*
iCreateWater.l(  waveHeight.f=2.0,   waveSpeed.f=300.0,   waveLength.f=10.0, *parent.l=#Null)
iSetWater( tileSizeX.f=20.0,  tileSizeY.f=20.0, tileCountX.l=40, tileCountY.l=40,	 countHillsX.f=0, countHillsY.f=0, textureRepeatCountX.f=10.0, textureRepeatCountY.f=10.0 )


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- BILLBOARD Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateBillboard.l(  sizex.f=10.0, sizey.f=10.0, colorTop.l=$ffffffff, colorBottom.l=$ffffffff, *parent.l=#Null) ; return *IBillboard
iBillboardColor(*bill.IBillboard, *colorTop.l,  *colorBottom.l)
iColorBillboard(*bill.IBillboard,  colorTop.l, colorBottom.l)
iBillboardSize(*bill.IBillboard,  *xx.f,  *yy.f)
iSizeBillboard(*bill.IBillboard,  xx.f,  yy.f)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- TERRAIN Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateTerrain.l(filename.s, scale.f=1.5, numQuads.l=8, numFaces.l=8, sizeTerrain.l=1024, *parent.l=#Null)
iLoadTextureTerrain.l(*terrain.ITerrain, filename.s, textureLayer.l=0)
iMaterialTypeTerrain(*terrain.ITerrain, newType.l)
iMaterialTextureTerrain(*terrain.ITerrain, *texture.ITexture, Layer.l=0 )
iMaterialFlagTerrain(*terrain.ITerrain, Flag.l,  newvalue.b)
iFreeTerrain(*terrain.ITerrain)
iTerrainBoundingBox(*terrain.ITerrain, *box.AABBOX)
iTerrainHeight.f(*terrain.ITerrain,  x.f,  z.f)
iTerrainQuadNode.l(*terrain.ITerrain, num.l)    ; return IQuadNode* 
iTerrainQuadNodeXZ.l(*terrain.ITerrain,  x.l,  z.l)    ; return IQuadNode* 
iTextureMappingTerrain(*terrain.ITerrain,  nquad.l,  layer.l,  n.l,  *texture.ITexture)
iTerrainPickedPosition(*terrain.ITerrain, *pos.iVECTOR3)
iTerrainPickedNormal(*terrain.ITerrain, *norm.iVECTOR3)
iTerrainPickedQuad.l(*terrain.ITerrain)
iTerrainPickedtriangle(*terrain.ITerrain, *triangles.f)
iPickTerrain.l(*terrain.ITerrain, x.l, y.l,  DistBase.l)
iHeightTerrain(*terrain.ITerrain, x.l, y.l,  hh.f)
iTerrainTransformation(*terrain.ITerrain,  *mat.iMATRIX)
iHardwareMapTerrain(*terrain.ITerrain, NewMappingHint.l=#EHM_STATIC)
iDirtyTerrain(*terrain.ITerrain,  BufferType.l=#EBT_VERTEX_AND_INDEX)
; for debug
iTerrainNQuad.l(*terrain.ITerrain)
iQuadDebugTerrain(*terrain.ITerrain, quaddebug.b=#True)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- PRIMITIVES 3D Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iDrawTriangle3D(*tri.f,  color.l=$ffffffff)
iDrawBox3D(*box.AABBOX, color.l=$ffffffff)
iDrawLine3D(startx.f,  starty.f,  startz.f,  endx.f,  endy.f,  endz.f, color.l=$ffffffff)
iSituatePrimitive3D( px.f=0,  py.f=0,  pz.f=0,  rx.f=0,  ry.f=0,  rz.f=0)
iMatrixPrimitive3D( *mdraw.iMATRIX )


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- MATERIAL Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateMaterial.l(flag.l=#Null) ; return IMaterial
iMaterialFlag.l(*material.IMaterial, flag.l) 
iMaterialTexture.l(*material.IMaterial,  i.l) ; return ITexture*
iMaterialTextureMatrix(*material.IMaterial,  i.l, *matrix.iMATRIX) 
iMaterialTransparent.l(*material.IMaterial) 
iFlagMaterial(*material.IMaterial, flag.l,  value.b) 
iTextureMaterial(*material.IMaterial,  i.l, *tex.ITexture) 
iTextureMatrixMaterial(*material.IMaterial, i.l,  *matrix.iMATRIX) 
iMaterialAmbientColor.l(*material.IMaterial) 
iAmbientColorMaterial(*material.IMaterial,  col.l) 
iMaterialDiffuseColor.l(*material.IMaterial) 
iDiffuseColorMaterial(*material.IMaterial,  col.l) 
iMaterialEmissiveColor.l(*material.IMaterial) 
iEmissiveColorMaterial(*material.IMaterial,  col.l) 
iMaterialBackfaceCulling.l(*material.IMaterial) 
iMaterialFogEnable.l(*material.IMaterial) 
iMaterialFrontfaceCulling.l(*material.IMaterial) 
iMaterialGouraudShading.l(*material.IMaterial) 
iMaterialShininess.f(*material.IMaterial) 
iShininessMaterial(*material.IMaterial,  shin.f) 
iMaterialSpecularColor.l(*material.IMaterial) 
iSpecularColorMaterial(*material.IMaterial,  col.l) 
iMaterialThickness.f(*material.IMaterial) 
iThicknessMaterial(*material.IMaterial, thick.f) 
iTypeParamMaterial(*material.IMaterial, param.f) 
iTypeParam2Material(*material.IMaterial, param.f) 
iTypeMaterial(*material.IMaterial,  type.l) 
iSetMaterial(*material.IMaterial) 
iCopyMaterial( *src.IMaterial, *dest.IMaterial) 
iTextureWrapMaterial(*material.IMaterial, value.l=0, layer.l=0) 

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- LIGHT Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateLight.l(  col.l=$ffffffff, radius.f=20, *parent.l=#Null) ; return *ILight
iCastShadowLight( *lgt.ILight, flag.b=#True)
iLightType.l( *lgt.ILight)
iTypeLight( *lgt.ILight, type.l)
iLightRadius.f( *lgt.ILight)
iRadiusLight( *lgt.ILight,  radius.f=100)
iAmbientColorLight( *lgt.ILight, col.l)
iLightAmbientColor.l( *lgt.ILight)
iSpecularColorLight( *lgt.ILight,  col.l)
iLightSpecularColor.l( *lgt.ILight)
iDiffuseColorLight( *lgt.ILight,  col.l)
iLightDiffuseColor.l( *lgt.ILight)
iAttenuationLight( *lgt.ILight,  constant.f,  linear.f,  quadratic.f)
iLightAttenuation( *lgt.ILight, *ret.iVECTOR3)
iLightDirection( *lgt.ILight, *ret.iVECTOR3)
iFalloffLight( *lgt.ILight,  falloff.f)
iLightFalloff.f( *lgt.ILight)
iInnerConeLight( *lgt.ILight,  InnerCone.f )
iLightInnerCone.f( *lgt.ILight)
iOuterConeLight( *lgt.ILight, OuterCone.f )
iLightOuterCone.f( *lgt.ILight)
iAmbientLight( color.l=$ffffffff)
iLightAmbient.l()
iCreateVolumeLight.l( tailcolor.l=$0, footcolor.l=$3300f090,  subdivU.l=32, subdivV.l=32, *parent.l=#Null ); return *IVolumeLight
iParametersVolumeLight( *vlight.IVolumeLight, tailcolor.l=0, footcolor.l=$3300f090,  subdivU.l=32,  subdivV.l=32)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- TEXTURE Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iTextureColorFormat.l( *tex.ITexture) 
iTextureOriginalSize(*tex.ITexture,  *width.l,  *height.l) 
iTexturePitch.l(*tex.ITexture) 
iTextureSize(*tex.ITexture, *width.l,  *height.l) 
iTextureMipMaps.l(*tex.ITexture) 
iTextureRenderTarget.l(*tex.ITexture) 
iLockTexture.l(*tex.ITexture,  readonly.b=#False) 
iUnlockTexture(*tex.ITexture) 
iMipMapLevelTexture(*tex.ITexture) 
iCreateRenderTargetTexture.l( width.l, height.l, format.l=#ECF_UNKNOWN)  ; return ITexture*
iCreateTexture.l( width.l=128,  height.l=128,  format.l=#ECF_A8R8G8B8)   ; return ITexture*
iCreateTextureWithImage.l( name.s, *img.IImage)   ; return ITexture*
iFindTexture.l(name.s)   ; return ITexture*
iLoadTexture.l(name.s)  ; return ITexture* 
iTextureCount.l() 
iColorKeyTexture(*tex.ITexture,  col.l) 
iNormalMapTexture(*tex.ITexture,  ampli.f= 1.0) 
iFreeTexture(*tex.ITexture) 
iFlagCreationTexture( flag.l,    enabled.b) 
iCreateListTexture.l(filename.s,  width.l, height.l) 

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- TEXTURE ANIMATOR Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateTextureAnimator.l( *texture.IArray,  timePerFrame.l,  loop.b=#True) ; return *INodeAnimator
iAddAnimatorTexture(*node.INode, *anim.INodeAnimator)
iFreeAnimatorTexture(*node.INode, *anim.INodeAnimator)
iAnimatorTextureIndex.l(*anim.INodeAnimator)
iAnimatorTextureStartTime.l(*anim.INodeAnimator)
iAnimatorTextureEndTime.l(*anim.INodeAnimator)
iAnimatorTextureSize.l(*anim.INodeAnimator)
iNodeAnimators.l(*node.INode,  num.l=0)
iRemoveAnimatorNode(*node.INode,  *anim.INodeAnimator)
iRemoveAnimatorsNode(*node.INode)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- IMAGES Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iLoadImage.l( filename.s )
iFreeImage( *img.IImage )
iCreateSubImage.l( *src.IImage,  posx.l,  posy.l, sizex.l,  sizey.l )
iCreateEmptyImage.l( format.l, sizex.l,  sizey.l )
iCreateScreenShot.l()
iSaveImage.l( *img.IImage, filename.s,  param.l=0)
iCopyRecImage( *src.IImage, *target.IImage,  posx.l,  posy.l,  orx.l,  ory.l,  w.l,  h.l)
iCopyImage( *src.IImage, *target.IImage)
iCopyWithAlphaImage( *src.IImage, *target.IImage, posx.l,  posy.l,  orx.l,  ory.l,  w.l,  h.l, color.l=$ffffffff)
iFillImage( *img.IImage,  color.l)
iImageAlphaMask.l( *img.IImage)
iImageBitsPerPixel.l( *img.IImage)
iImageBytesPerPixel.l( *img.IImage)
iImageBlueMask.l( *img.IImage)
iImageGreenMask.l( *img.IImage)
iImageRedMask.l( *img.IImage)
iImageColorFormat.l( *img.IImage)
iImageDimension( *img.IImage,  *w.l,  *h.l)
iImageSize.l( *img.IImage)
iImageSizeInPixels.l( *img.IImage)
iImagePitch.l( *img.IImage)
iImagePixel.l( *img.IImage,  x.l,  y.l)
iPixelImage( *img.IImage,  x.l,  y.l,  color.l=$ffffffff)
iLockImage.l( *img.IImage)
iUnlockImage( *img.IImage)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- ANIMATION Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateAnimation.l(*model.IObject, *parent.l=#Null) ; return *IAnimatedMesh
iSpeedAnimation(*anim.IAnimatedMesh,  speed.f )
iAnimateJointAnimation(*anim.IAnimatedMesh, CalculateAbsolutePositions.b=#True )
iCloneAnimation.l(*anim.IAnimatedMesh, *parent.l=#Null) ; return *IAnimatedMesh
iAnimationEndFrame(*anim.IAnimatedMesh)
iAnimationFrameNumber.f(*anim.IAnimatedMesh)
iFrameLoopAnimation(*anim.IAnimatedMesh,  Fbegin.l=0, Fend.l=0)
iAnimationJointCount.l(*anim.IAnimatedMesh)
iAnimationJointNode.l(*anim.IAnimatedMesh, jointID.l=0) ; return *IBoneNode
iAnimationJointNodebyName.l(*anim.IAnimatedMesh, name.s)
iAnimationStartFrame.l(*anim.IAnimatedMesh)
iCurrentFrameAnimation(*anim.IAnimatedMesh,  frame.f)
iJointModeAnimation(*anim.IAnimatedMesh, mode.l=#EJUOR_NONE )
iLoopModeAnimation(*anim.IAnimatedMesh, mode.b=#True)
iRenderFromIdentityAnimation(*anim.IAnimatedMesh, mode.b=#True)
iTransitionTimeAnimation(*anim.IAnimatedMesh,  ttime.f)
; shadowVolume
iShadowVolumeAnimation.l(*anim.IAnimatedMesh,  zfailmethod.b=#True, infinity.f=10000.0 )
iUpdateShadowVolume(*shad.IShadowVolumeNode)
; Bones 
iBoneAnimationMode.l(*bone.IBoneNode)
iBoneIndex.l(*bone.IBoneNode)
iBoneName.l(*bone.IBoneNode) ; return char*
iBoneBoundingBox(*bone.IBoneNode, *bound.AABBOX)
iBoneSkinningSpace.l(*bone.IBoneNode)
iOnAnimateBone(*bone.IBoneNode, timeMS.l)
iAnimationModeBone(*bone.IBoneNode, mode.l)
iSkinningSpaceBone(*bone.IBoneNode, space.l)
iUpdateAbsolutePositionOfAllChildrenBone(*bone.IBoneNode)
iBonePositionHint.l(*bone.IBoneNode)
iBoneScaleHint.l(*bone.IBoneNode)
iBoneRotationHint.l(*bone.IBoneNode)
iBoneAnimationParent.l(*bone.IBoneNode)
iPositionHintBone(*bone.IBoneNode,  hint.l=-1)
; MD2
iAnimationMD2(*anim.IAnimatedMesh,  type.l=#EMAT_STAND )
iAnimationMD2byName(*anim.IAnimatedMesh,  animationName.s )
iMD2AnimationCount.l(*anim.IAnimatedMesh)
iMD2AnimationName.l(*anim.IAnimatedMesh, nr.l=0) ; return char*
iMD2FrameLoopName(*anim.IAnimatedMesh, name.s, *outBegin.l,*outEnd.l, *outFPS.l)   
iMD2FrameLoopType(*anim.IAnimatedMesh, type.l, *outBegin.l,*outEnd.l, *outFPS.l)   
; MD3
iInterpolationShiftMD3(*anim.IAnimatedMesh,  shift.l,  loopMode.l)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- CAMERA Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateCamera.l(*parent.l=#Null) ; return *ICamera
iCameraTarget(*cam.ICamera, *res.f)
iTargetCamera(*cam.ICamera,  x.f,  y.f,  z.f)
iTargetAndRotationCamera(*cam.ICamera, flag.b=#True)
iCameraAspectRatio.f(*cam.ICamera )
iCameraFarValue.f(*cam.ICamera )
iCameraNearValue.f(*cam.ICamera )
iCameraFOV.f(*cam.ICamera )
iCameraProjectionMatrix(*cam.ICamera, *mat.iMATRIX)
iCameraUpVector(*cam.ICamera, *vect.iVECTOR3 )
iCameraViewMatrix(*cam.ICamera, *mat.iMATRIX)
iAspectRatioCamera(*cam.ICamera, aspect.f)
iFarValueCamera(*cam.ICamera,  farv.F)
iFOVCamera(*cam.ICamera,  fov.f)
iNearValueCamera(*cam.ICamera,  nearv.f)
iUpVectorCamera(*cam.ICamera,   x.f,  y.f,  z.f)
iCameraBoxInside(*cam.ICamera,  *box.AABBOX)
iActiveCamera(*cam.ICamera)
iCameraActive.l()
iProjectionMatrixCamera(*cam.ICamera,  *projection.iMATRIX,  isOrthogonal.b=#False)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- PARTICLE Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateParticleSystem( withDefaultEmitter.b=#False, *parent.l=#Null )
iCreateParticleBoxEmitter.l(*part.IParticleSystem, dirx.f=0, diry.f=0.03, dirz.f=0, minParticlesPerSecond.l=5, maxParticlesPerSecond.l=10, mnStartColor.l=$ff000000, mxStartColor.l=$ffffffff, lifeTimeMin.l=2000, lifeTimeMax.l=4000, maxAngleDegrees.l=0,  dimminx.f=5.0, dimminy.f=5.0, dimmaxx.f=5.0, dimmaxy.f=5.0, *bbox.AABBOX=#Null) ; return IParticleBox*
iCreateParticleCylinderEmitter.l(*part.IParticleSystem, centerx.f,  centery.f,  centerz.f, radius.f, normalx.f, normaly.f, normalz.f, length.f, outlineOnly.b=#False, dirx.f=0, diry.f=0.03, dirz.f=0, minParticlesPerSecond.l=5, maxParticlesPerSecond.l=10, minStartCol.l=$ff000000, maxStartCol.l=$ffffffff,lifeTimeMin.l=2000, lifeTimeMax.l=4000, maxAngleDegrees.l=0, minStartSx.f=5.0, minStartSy.f=5.0, maxStartSx.f=5.0,  maxStartSy.f=5.0) 
iCreateParticleSphereEmitter.l(*part.IParticleSystem, centerx.f,  centery.f,  centerz.f, radius.f,  dirx.f=0, diry.f=0.03, dirz.f=0, minParticlesPerSecond.l=5, maxParticlesPerSecond.l=10, minStartCol.l=$ff000000, maxStartCol.l=$ffffffff,lifeTimeMin.l=2000, lifeTimeMax.l=4000, maxAngleDegrees.l=0, minStartSx.f=5.0, minStartSy.f=5.0, maxStartSx.f=5.0,  maxStartSy.f=5.0) 
iCreateParticleMeshEmitter.l(*part.IParticleSystem, *mesh.IMesh, useNormalDirection.b=#True, dirx.f=0, diry.f=0.03, dirz.f=0, normalDirectionModifier.f=100.0, mbNumber.l=-1, everyMeshVertex.b = #False,minParticlesPerSecond.l=5, maxParticlesPerSecond.l=10, minStartCol.l=$ff000000, maxStartCol.l=$ffffffff,lifeTimeMin.l=2000, lifeTimeMax.l=4000, maxAngleDegrees.l=0, minStartSx.f=5.0, minStartSy.f=5.0, maxStartSx.f=5.0,  maxStartSy.f=5.0) 																			 
																			 
iScaleParticleSystem(*part.IParticleSystem, spx.f=1.0, spy.f=1.0)
iRotationParticleSystem(*part.IParticleSystem, spx.f=5.0,  spy.f=5.0, spz.f=5.0, px.f=0, py.f=0, pz.f=0)
iAttractionParticleSystem(*part.IParticleSystem, pointx.f, pointy.f, pointz.f, speed.f=1.0, attract.b=#True,  affectX.b=#True,  affectY.b=#True,  affectZ.b=#True )
iAddEmitterParticleSystem(*part.IParticleSystem, *em.IParticle )
iFadeOutParticleSystem(*part.IParticleSystem,  targetColor.l=0,   timeNeededToFadeOut.l=1000 )
iParticleSystemEmitter.l(*part.IParticleSystem)
iGlobalParticleSystem(*part.IParticleSystem, Glob.b=#True)
iParticleSizeParticleSystem(*part.IParticleSystem, sx.f=1.0, sy.f=1.0)
; IParticle functions
iMinStartSizeParticle(*em.IParticle,  dimx.f,  dimy.f  )
iMaxStartSizeParticle(*em.IParticle,  dimx.f,  dimy.f  )
iParticleDirection(*em.IParticle,  *dirx.f,  *diry.f,  *dirz.f  )
iParticleMaxPerSecond.l(*em.IParticle)
iParticleMinPerSecond.l(*em.IParticle )
iDirectionParticle(*em.IParticle,  dirx.f, diry.f, dirz.f  )
iMinPerSecondParticle(*em.IParticle,  minPPS.l )
iMaxPerSecondParticle(*em.IParticle,  maxPPS.l )
iParticleType.l(*em.IParticle )
iParticleMaxStartColor.l(*em.IParticle)
iParticleMinStartColor.l(*em.IParticle )
iParticleMaxStartSize(*em.IParticle,  *dimx.f,  *dimy.f )
iParticleMinStartSize(*em.IParticle,  *dimx.f,  *dimy.f )
iMaxStartColorParticle(*em.IParticle,  col.l )
iMinStartColorParticle(*em.IParticle,  col.l )



; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- FileSystem Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iAddZipFileArchive(filename.s)
iAddFolderFileArchive(filename.s,  ignoreCase.b=#True,   ignorePaths.b=#True)  
iAddPakFileArchive(filename.s, ignoreCase.b=#True,   ignorePaths.b=#True)  
iChangeWorkingDirectory(filename.s) 
iCreateAndOpenFile.l(filename.s) 
iCreateAndWriteFile.l(filename.s, append.b=#False)
iCreateFileList.l()  
iFreeFileList(*list.IFileList)  
iCreateMemoryReadFile(*memory.l , len.l, fileName.s, deleteMemoryWhenDropped.b=#False) 
iExistFile(fileName.s)  
iWorkingDirectory.l() ; return char *
; IReadFile
iReadFileFileName.l(*rf.IReadFile) ; return char *  
iReadFilePos.l(*rf.IReadFile)  
iReadFileSize.l(*rf.IReadFile)  
iReadFileRead.l(*rf.IReadFile, *buffer.l, sizeToRead.l)  
iReadFileSeek.l(*rf.IReadFile, finalPos.l,  relativeMovement.b=#False) 
iCloseReadFile(*rf.IReadFile)  
; IWriteFile
iWriteFileName.l(*wf.IWriteFile)  ; return char *  
iWriteFilePos.l(*wf.IWriteFile) 
iWriteFileSeek.l(*wf.IWriteFile, finalPos.l,  relativeMovement.b=#False) 
iWriteFileWrite.l(*wf.IWriteFile, *buffer.l, sizeToWrite.l)  
iCloseWriteFile(*wf.IWriteFile)  
; IFileList
iFileListCount.l(*fl.IFileList)  
iFileListName.l(*fl.IFileList, index.l)  
iFileListFullName.l(*fl.IFileList, index.l)  
iFileListisDirectory.l(*fl.IFileList, index.l)  

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- 2D Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iDrawLine2D(sx.l,  sy.l, ex.l,  ey.l,  color.l=$ffffffff)
iDrawPolygon2D(sx.l,  sy.l, radius.f,  color.l=$ffffffff,  vertexcount.l=10)
iDrawRectangle2D(sx.l,  sy.l, ex.l,  ey.l,  colorLUp.l=$ffffffff,  colorRUp.l=$ffffffff,  colorLDown.l=$ffffffff,  colorRDown.l=$ffffffff, *clip.l=#Null)
iDrawRect2D(sx.l,  sy.l, ex.l,  ey.l,  color.l=$ffffffff,  *clip.l=#Null)
iDrawSubRectImage2D(*text.ITexture ,destx.l,  desty.l, destex.l,  destey.l, srcx.l,  srcy.l, srcex.l,  srcey.l,  *color.l=#Null,  *clip.l=#Null, useAlphaChannelOfTexture.b=#False )
iDrawRectImage2D(*text.ITexture ,posx.l,  posy.l, srcx.l,  srcy.l, srcex.l,  srcey.l,  color.l=$ffffffff,  *clip.l=#Null, useAlphaChannelOfTexture.b=#False )
iDrawImage2D(*text.ITexture ,posx.l,  posy.l)
iBegin2D( width.l=0, height.l=0)
iEnd2D()
; sprite2D
iCreateSprite2D.l(texturename.s, ssize.f=1.0, color.l=$ffffffff, *parent.l=#Null)
iCenterSprite2D(*sp.ISprite2D,  x.f,  y.f) 
iRenderSprite2D(*sp.ISprite2D) 


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- GUI Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iTextGUI(*gui.IGUIElement, text.s)
iToolTipTextGUI(*gui.IGUIElement, text.s)
iVisibleGUI(*gui.IGUIElement, flag.b)
iRelativePositionGUI(*gui.IGUIElement, posx.l,  posy.l)
iRelativeRectGUI(*gui.IGUIElement, posx.l,  posy.l,  ox.l,  oy.l)
iGUIAbsoluteRect(*gui.IGUIElement, *posx.l,  *posy.l,  *ox.l,  *oy.l)
iGUIAbsoluteClippingRect(*gui.IGUIElement, *posx.l,  *posy.l,  *ox.l,  *oy.l)
iGUIChildren.l(*gui.IGUIElement,  num.l=0)
iChildrenGUI(*gui.IGUIElement, *child.IGUIElement)
iBringToFrontGUI.l(*gui.IGUIElement)
iGUIElementFromId.l(*gui.IGUIElement,  Id.l, searchchildren.b=#False)
iGUIID.l(*gui.IGUIElement)
iGUIParent.l(*gui.IGUIElement)
iGUIType.l(*gui.IGUIElement)
iGUIisEnabled.l(*gui.IGUIElement)
iGUIisPointInside.l(*gui.IGUIElement,  posx.l,  posy.l)
iGUIVisible.l(*gui.IGUIElement)
iMoveGUI(*gui.IGUIElement,  posx.l,  posy.l)
iFreeGUI(*gui.IGUIElement)
iFreeChildGUI(*gui.IGUIElement, *child.IGUIElement)
iEnabledGUI(*gui.IGUIElement,  enable.b=#True)
iIDGUI(*gui.IGUIElement,  ID.l=-1)
iMaxSizeGUI(*gui.IGUIElement, posx.l,  posy.l)
iMinSizeGUI(*gui.IGUIElement, posx.l,  posy.l)
iGUIText.l(*gui.IGUIElement)
iGUIEventCallBack(*procedureGUIEventCallBack.l)
iGUIColor.l( index.l)
iColorGUI(index.l, color.l)

; text and font
iAddStaticText.l(text.s,  x.l,  y.l,  rx.l,  ry.l, border.b=#False, wordWrap.b=#True, fillBackground.b=#False, *parent.l=#Null, id.l=-1)
iLoadFont(filename.s, egui.l = #EGDF_DEFAULT )
iGetFont.l()
iDrawText(*font.IGUIFont, text.s,  x.l,  y.l,  rx.l,  ry.l, color.l=$ff9999ff)
iGUIText_EnableOverrideColor(*text.IGUIStaticText, enable.b)
iGUIText_OverrideColor.l(*text.IGUIStaticText)
iGUIText_OverrideFont.l(*text.IGUIStaticText)  ; return IGUIFont*
iGUIText_Height.l(*text.IGUIStaticText)
iGUIText_Width.l(*text.IGUIStaticText)
iBackgroundColor_GUIText(*text.IGUIStaticText, color.l=$ffffffff)
iDrawBackground_GUIText(*text.IGUIStaticText,  draw.b)
iDrawBorder_GUIText(*text.IGUIStaticText,  draw.b)
iOverrideColor_GUIText(*text.IGUIStaticText,  color.l=$ffffffff)
iOverrideFont_GUIText(*text.IGUIStaticText, *font.IGUIFont)
iAlignment_GUIText(*text.IGUIStaticText, h.l, v.l)
iWordWrap_GUIText(*text.IGUIStaticText,  enable.b)
; button
iAddButtonGUI.l(orx.l, ory.l, sx.l, sy.l,  text.s, tooltiptext.s="", *parent.IGUIElement=#Null , id.l=-1  )
iGUIButton_AlphaChannel.l(*button.IGUIElement )
iGUIButton_DrawingBorder.l(*button.IGUIElement )
iGUIButton_Pressed.l(*button.IGUIElement )
iGUIButton_PushButton.l(*button.IGUIElement )
iDrawBorder_GUIButton(*button.IGUIElement, border.b=#True)
iImage_GUIButton(*button.IGUIElement, *image.ITexture=#Null)
iPushButton_GUIButton(*button.IGUIElement, isPushButton.b=#False )
iOverrideFont_GUIButton(*button.IGUIElement, *font.IGUIFont  )
iPressed_GUIButton(*button.IGUIElement,  pressed.b=#True  )
iPressedImage_GUIButton(*button.IGUIElement,  *image.ITexture=#Null)
iSprite_GUIButton(*button.IGUIElement, state.l, index.l, color.l=$ffffffff, loop.b=#False )
iSpriteBank_GUIButton(*button.IGUIElement,  *bank.IGUISpriteBank )
iAlphaChannel_GUIButton(*button.IGUIElement,  useAlphaChannel.b=#False )
; CursorControl
iCursorControlPosition( *posx.l, *posy.l)
iCursorControlRelativePosition( *posx.f, *posy.f)
iCursorControlVisible.l()
iPositionCursorControl( x.l, y.l)
iReferenceRectCursorControl( orx.l, ory.l, sx.l, sy.l)
iVisibleCursorControl( visible.b=#True )
iCursorControlX.l()
iCursorControlY.l()
; CheckBox
iAddCheckBoxGUI.l( checked.b, orx.l, ory.l, sx.l, sy.l,  text.s, *parent.IGUIElement=#Null , id.l=-1  )
iGUICheckBox_Check.l( *check.IGUICheckBox )
iCheck_GUICheckBox(*check.IGUICheckBox , checked.b=#True  )
; EditBox
iAddEditBox.l(text.s, x.l,  y.l,  rx.l,  ry.l, border.b=#True, *parent.IGUIElement=#Null , id.l=-1  )
iEnableOverrideColor_GUIEditBox(*gui.IGUIEditBox , enable.b)
iGUIEditBox_Max.l(*gui.IGUIEditBox)
iGUIEditBox_AutoScrollEnabled.l(*gui.IGUIEditBox)
iGUIEditBox_TextDimension(*gui.IGUIEditBox, *dimx.l, *dimy.l)
iGUIEditBox_MultiLineEnabled.l(*gui.IGUIEditBox)
iAutoScroll_GUIEditBox(*gui.IGUIEditBox, enable.b=#True)
iDrawBorder_GUIEditBox(*gui.IGUIEditBox, enable.b=#True)
iMax_GUIEditBox(*gui.IGUIEditBox, mm.l=128)
iMultiline_GUIEditBox(*gui.IGUIEditBox, enable.b=#True)
iOverrideColor_GUIEditBox(*gui.IGUIEditBox, color.l=$ffffffff)
iOverrideFont_GUIEditBox(*gui.IGUIEditBox, *font.IGUIFont  )
iTextAlignment_GUIEditBox(*gui.IGUIEditBox, h.l, v.l)
; GUI Image
iAddImageGUI.l(*img.ITexture, posx.l, posy.l, useAlphaChannel.b=#True, text.s="text", *parent.IGUIElement=#Null , id.l=-1 )
iAddEmptyImageGUI.l(posx.l, posy.l, osx.l, osy.l, text.s, *parent.IGUIElement=#Null , id.l=-1 )
iGUIImage_AlphaChannelUsed.l( *img.IGUIImage )
iGUIImage_ImageScaled.l(*img.IGUIImage)
iColor_GUIImage(*img.IGUIImage, color.l=$ffffffff )
iImage_GUIImage(*img.IGUIImage,  *image.ITexture )
iScale_GUIImage(*img.IGUIImage, enable.b )
iAlphaChannel_GUIImage(*img.IGUIImage, enable.b=#True )
; ComboBox
iAddComboBoxGUI.l( x.l,  y.l,  rx.l,  ry.l, *parent.IGUIElement=#Null , id.l=-1 )
iAddItem_GUIComboBox.l( *combo.IGUIComboBox, text.s)
iClear_GUIComboBox(*combo.IGUIComboBox)
iGUIComboBox_Item.l(*combo.IGUIComboBox,  idx.l=0)
iGUIComboBox_ItemCount.l(*combo.IGUIComboBox)
iGUIComboBox_Selected.l(*combo.IGUIComboBox)
iRemoveItem_GUIComboBox(*combo.IGUIComboBox, idx.l=0)
iSelected_GUIComboBox(*combo.IGUIComboBox, idx.l=0)
iTextAlignment_GUIComboBox(*combo.IGUIComboBox, h.l, v.l)
; ContextMenu
iAddContexMenuGUI.l(x.l,  y.l,  rx.l,  ry.l, *parent.IGUIElement=#Null , id.l=-1 )
iAddItem_GUIContexMenu.l(*menu.IGUIContextMenu, text.s, commandId.l=-1, enable.b=#True, hasSubMenu.b=#False , checked.b=#False )
iAddSeparator_GUIContexMenu(*menu.IGUIContextMenu)
iGUIContexMenu_ItemCommandId.l(*menu.IGUIContextMenu, idx.l=0)
iGUIContexMenu_ItemCount.l(*menu.IGUIContextMenu)
iGUIContexMenu_ItemText.l(*menu.IGUIContextMenu, idx.l=0)
iGUIContexMenu_ItemSelected.l(*menu.IGUIContextMenu)
iGUIContexMenu_SubMenu.l(*menu.IGUIContextMenu, idx.l=0)
iGUIContexMenu_ItemChecked.l(*menu.IGUIContextMenu, idx.l=0)
iGUIContexMenu_ItemEnabled.l(*menu.IGUIContextMenu, idx.l=0)
iRemoveAll_GUIContexMenu(*menu.IGUIContextMenu)
iRemoveItem_GUIContexMenu(*menu.IGUIContextMenu, idx.l=0)
iItemChecked_GUIContexMenu(*menu.IGUIContextMenu, idx.l=0, enable.b=#True)
iItemCommanId_GUIContexMenu(*menu.IGUIContextMenu, idx.l=0, id.l=-1)
iItemEnabled_GUIContexMenu(*menu.IGUIContextMenu, idx.l=0, enable.b=#True)
iItemText_GUIContexMenu(*menu.IGUIContextMenu, idx.l, text.s)
; Sprite Bank
iAddEmptySpriteBankGUI.l(name.s)
iAddTexture_GUISpriteBank(  *sp.IGUISpriteBank,  *texture.ITexture  )
iDraw2D_GUISpriteBank( *sp.IGUISpriteBank, index.l, posx.l, posy.l, color.l=$ffffffff, starttime.l=0,	currenttime.l=0, loop.b=#True, center.b=#False, *clipox.l=#Null ) 
iGUISpriteBank_Texture( *sp.IGUISpriteBank, idx.l=0)
iGUISpriteBank_TextureCount( *sp.IGUISpriteBank)
iTexture_GUISpriteBank( *sp.IGUISpriteBank, idx.l, *texture.ITexture)
; FileOpenDialog
iAddFileOpenDialogGUI( title.s, modal.b=#True, *parent.IGUIElement=#Null , id.l=-1 )
iGUIFileOpenDialog_FileName.l( *dial.IGUIFileOpenDialog )
; InOutFader
iAddInOutFaderGUI.l(*rect.l, *parent.IGUIElement=#Null , id.l=-1 ); return IGUIInOutFader*
iFadeIn_GUIInOutFader( *inout.IGUIInOutFader,  time.l)
iFadeOut_GUIInOutFader(*inout.IGUIInOutFader, time.l)
iGUIInOutFader_Color.l(*inout.IGUIInOutFader)
iGUIInOutFader_Ready.l(*inout.IGUIInOutFader)
iColor_GUIInOutFader(*inout.IGUIInOutFader,  color.l=$ffffffff)
; ListBox
iAddListBoxGUI.l( orx.l,  ory.l,  sx.l,  sy.l,  drawBackground.b=#True, *parent.IGUIElement=#Null , id.l=-1 )
iAddItem_GUIListBox(*lbox.IGUIListBox, item.s, icon.l=-1)
iClear_GUIListBox(*lbox.IGUIListBox)
iClearItemOverrideColor_GUIListBox(*lbox.IGUIListBox,  idx.l)
iGUIListBox_Icon.l(*lbox.IGUIListBox,  idx.l)
iGUIListBox_ItemCount.l(*lbox.IGUIListBox)
iGUIListBox_ItemDefaultColor.l(*lbox.IGUIListBox,  colorType.l )
iGUIListBox_ItemOverrideColor.l(*lbox.IGUIListBox,  idx.l,  colorType.l )
iGUIListBox_ListItem.l(*lbox.IGUIListBox,  idx.l)
iGUIListBox_Selected.l(*lbox.IGUIListBox)
iGUIListBox_HasItemOverrideColor.l(*lbox.IGUIListBox,  idx.l,  colorType.l )
iInsertItem_GUIListBox.l(*lbox.IGUIListBox,  idx.s, item.s,  icon.l )
iGUIListBox_AutoScrollEnabled.l(*lbox.IGUIListBox)
iRemoveItem_GUIListBox(*lbox.IGUIListBox,  idx.l)
iAutoScrollEnabled_GUIListBox(*lbox.IGUIListBox,  scroll.b=#True)
iItem_GUIListBox(*lbox.IGUIListBox,  idx.l, item.s,  icon.l )
iItemOverrideColor_GUIListBox(*lbox.IGUIListBox,  idx.l,  colorType.l,  color.l )
iSelected_GUIListBox(*lbox.IGUIListBox,  idx.l)
iSpriteBank_GUIListBox(*lbox.IGUIListBox,   *bank.IGUISpriteBank  )
iSwapItems_GUIListBox(*lbox.IGUIListBox,  idx1.l,  idx2.l)
; Menu
iAddMenuGUI.l(*parent.IGUIElement=#Null , id.l=-1 )
; messagebox
iAddMessageBoxGUI.l(caption.s, text.s, modal.b=#True, flag.l=#EMBF_OK, *parent.IGUIElement=#Null , id.l=-1 )
iGUIMessageBox_CloseButton.l( *mb.IGUIWindow)
iGUIMessageBox_MaximizeButton.l(*mb.IGUIWindow)
iGUIMessageBox_MinimizeButton.l(*mb.IGUIWindow)
; modal screen
iAddModalScreenGUI.l(*parent.IGUIElement=#Null)
; scroll bar
iAddScrollBarGUI.l( horizontal.b, orx.l,  ory.l,  sx.l,  sy.l, *parent.IGUIElement=#Null , id.l=-1 )
iGUIScrollBar_LargeStep.l( *sb.IGUIScrollBar)
iGUIScrollBar_Max.l(*sb.IGUIScrollBar)
iGUIScrollBar_Pos.l(*sb.IGUIScrollBar)
iGUIScrollBar_SmallStep.l(*sb.IGUIScrollBar)
iLargeStep_GUIScrollBar(*sb.IGUIScrollBar,  value.l)
iMax_GUIScrollBar(*sb.IGUIScrollBar,  value.l)
iPos_GUIScrollBar(*sb.IGUIScrollBar,  value.l)
iSmallStep_GUIScrollBar(*sb.IGUIScrollBar,  value.l)
; spin box
iAddSpinBoxGUI.l(text.s, orx.l,  ory.l,  sx.l,  sy.l, border.b=#True, *parent.IGUIElement=#Null , id.l=-1 )
iGUISpinBox_EditBox.l( *spb.IGUISpinBox)
iGUISpinBox_Max.f(*spb.IGUISpinBox)
iGUISpinBox_Min.f(*spb.IGUISpinBox)
iGUISpinBox_StepSize.f(*spb.IGUISpinBox)
iGUISpinBox_Value.f(*spb.IGUISpinBox)
iDecimalPlaces_GUISpinBox(*spb.IGUISpinBox, value.l)
iRange_GUISpinBox(*spb.IGUISpinBox,  min.f,  max.f)
iStepSize_GUISpinBox(*spb.IGUISpinBox, sStep.f)
iValue_GUISpinBox(*spb.IGUISpinBox, value.f)
; tabcontrol 
iAddTabControlGUI(orx.l,  ory.l,  sx.l,  sy.l, fillbackground.b=#False,	border.b=#True, *parent.IGUIElement=#Null , id.l=-1 )
iAddTab_GUITabControl.l(*tabc.IGUITabControl, caption.s, id.l=-1)
iGUITabControl_ActiveTab.l(*tabc.IGUITabControl)
iGUITabControl_Tab.l(*tabc.IGUITabControl, idx.l=-1)
iGUITabControl_TabCount.l(*tabc.IGUITabControl)
iGUITabControl_TabExtraWidth.l(*tabc.IGUITabControl)
iGUITabControl_TabHeight.l(*tabc.IGUITabControl)
iGUITabControl_TabVerticalAlignment.l(*tabc.IGUITabControl)
iActiveTab_GUITabControl.l(*tabc.IGUITabControl,  *tab.IGUIElement )
iActiveTabId_GUITabControl.l(*tabc.IGUITabControl, idx.l=0 )
iTabExtraWidth_GUITabControl(*tabc.IGUITabControl,  extraWidth.l  )
iTabHeight_GUITabControl(*tabc.IGUITabControl, height.l )
iTabVerticalAlignment_GUITabControl(*tabc.IGUITabControl, align.l )
; tab functions
iAddTabGUI(orx.l,  ory.l,  sx.l,  sy.l, *parent.IGUIElement=#Null , id.l=-1 )
iBackgroundColor_GUITab( *tab.IGUITab, color.l=$ffffffff)
iGUITab_BackgroundColor.l(*tab.IGUITab)
iGUITab_Number.l(*tab.IGUITab)
iGUITab_TextColor.l(*tab.IGUITab)
iGUITab_isDrawingBackground.l(*tab.IGUITab)
iDrawBackground_GUITab(*tab.IGUITab, flag.b=#True)
iTextColor_GUITab(*tab.IGUITab,  color.l=$ffffffff)
; Table
iAddTableGUI.l(orx.l,  ory.l,  sx.l,  sy.l, drawBackground.b=#True, *parent.IGUIElement=#Null , id.l=-1 )
iAddColumn_GUITable(*table.IGUITable, caption.s, columnIndex.l=-1 )
iAddRow_GUITable(*table.IGUITable,  rowIndex.l )
iClear_GUITable(*table.IGUITable)
iClearRows_GUITable(*table.IGUITable)
iGUITable_ActiveColumn.l(*table.IGUITable)
iGUITable_ActiveColumnOrdering.l(*table.IGUITable)
iGUITable_CellData.l(*table.IGUITable,  rowIndex.l,  columnIndex.l)
iGUITable_CellText.l(*table.IGUITable,  rowIndex.l,  columnIndex.l)   
iGUITable_ColumnCount.l(*table.IGUITable)   
iGUITable_DrawFlags.l(*table.IGUITable)   
iGUITable_RowCount.l(*table.IGUITable)   
iGUITable_Selected.l(*table.IGUITable)   
iGUITable_hasResizableColumns.l(*table.IGUITable)
iOderRows_GUITable(*table.IGUITable,  columnindex.l=-1, mode.l=#EGOM_NONE ) 
iRemoveColumn_GUITable(*table.IGUITable, columnindex.l=-1)
iRemoveRow_GUITable(*table.IGUITable, columnindex.l=-1)
iActiveColumn_GUITable(*table.IGUITable,  index.l,  doOrder.b=#False)   
iCellColor_GUITable(*table.IGUITable, rowindex.l, columnindex.l, color.l=$ffffffff)
iCellData_GUITable(*table.IGUITable, rowindex.l, columnindex.l, *ddata.l)
iCellText_GUITable(*table.IGUITable, rowindex.l, columnindex.l, text.s, color.l=$ffffffff)
iColumnOrdering_GUITable(*table.IGUITable, columnindex.l, mode.l=#EGCO_NONE  ) 
iColumnWidth_GUITable(*table.IGUITable, columnindex.l,  width.l) 
iDrawFlags_GUITable(*table.IGUITable, flag.l)
iResizableColumns_GUITable(*table.IGUITable, flag.b) 
iSwapRows_GUITable(*table.IGUITable, rowindexA.l, rowindexB.l) 
; ToolBar
iAddToolBarGUI.l(*parent.IGUIElement=#Null , id.l=-1 )
iAddButton_GUIToolBar(*tb.IGUIToolBar, text.s, tooltiptext.s, *img.ITexture=#Null,*pressedimg.ITexture=#Null,  isPushButton.b=#False,  useAlphaChannel.b=#False, id.l=-1)
; GUI Window
iAddWindowGUI.l(orx.l,  ory.l,  sx.l,  sy.l, text.s="window", modal.b=#False, *parent.IGUIElement=#Null , id.l=-1 )
iGUIWindow_CloseButton.l( *win.IGUIWindow )
iGUIWindow_MaximizeButton.l( *win.IGUIWindow )
iGUIWindow_MinimizeButton.l( *win.IGUIWindow )
; GUI Environement, to be continued....
iSetSkinGUI.l( type.l )
iClearGUI()
iGUI_BuiltInFont.l()
iGUI_Focus.l()
iGUI_SpriteBank.l(filename.s)
iGUI_VideoDriver.l()
iFocus_GUI.l( *element.IGUIElement )
iGUI_HasFocus.l( *element.IGUIElement )
iLoad_GUI.l( filename.s, *parent.IGUIElement=#Null )
iSave_GUI.l( filename.s, *start.IGUIElement=#Null  )
;  Skin GUI
iCustomSkinGUI.l(configSkinname.s)
iColor_GUISkin(*skin.IGUISkin, which.l=#EGDC_3D_FACE ,  color.l=$ffffffff)
iGUISkin_Color.l(*skin.IGUISkin, which.l=#EGDC_3D_FACE)
iSkinGUI_Curent.l()
iSize_GUISkin(*skin.IGUISkin, which.l,  size.l)
iGUISkin_Size.l(*skin.IGUISkin, which.l)
iDefaultText_GUISkin(*skin.IGUISkin, which.l, text.s)
; progress bar (only with Custum Skin loaded
iAddProgressBarGUI.l(orx.l,  ory.l,  sx.l,  sy.l, *parent.IGUIElement=#Null)
iValue_ProgressBarGUI(*bar.IGUIProgressBar,  progress.f=0.5)
iProgressBarGUI_Value.f(*bar.IGUIProgressBar)
iGUIProgressBar_Color.l(*bar.IGUIProgressBar)
iColor_GUIProgressBar(*bar.IGUIProgressBar,  color.l=$ffffffff)
iAutomaticText_GUIProgressBar(*bar.IGUIProgressBar,  format.s)
iEmptyColor_GUIProgressBar(*bar.IGUIProgressBar, color.l=$ffffffff)
iGUIProgressBar_EmptyColor(*bar.IGUIProgressBar)

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- Event Input Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iGetKey.l()
iMouseEvent.l()
iGetKeyDown.l( keyCode.l)
iGetKeyUp.l( keyCode.l)
iGetMouseX.l()
iGetMouseY.l()
iGetDeltaMouseX.l(fcursor.b=#False)
iGetDeltaMouseY.l(fcursor.b=#False)
iGetMouseEvent.l(event.l)
iGetLastKey.l()
iPositionCursor( x.f,  y.f)
iCursorX.l()
iCursorY.l()
; Joystick
iActivateJoysticks()
iJoysticksAxis.l(axis.l)
iJoysticksButtonStates.l()
iJoysticksPOV.l()
iJoysticksJoy.l()

; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;-CORE Utils Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iCreateArray.l() ; return IArray
iPushbackArray( *arr.IArray,  *el.l) 
iPushfrontArray( *arr.IArray,  *el.l) 
iArrayElement.l( *arr.IArray,  i.l)
iArraySize.l( *arr.IArray )  
iFreeArray( *arr.IArray) 
iProjectionMatrixOrthoLH(w.f,  h.f, *projection.iMATRIX, zNear.f=0.1,  zFar.f=100.0)
iProjectionMatrixOrthoRH(w.f,  h.f, *projection.iMATRIX, zNear.f=0.1,  zFar.f=100.0)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- SHADER Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iVersionShader(VSType.l=#EVST_VS_1_1, PSType.l=#EPST_PS_1_1)
iCreateShaderHighLevel.l(vsFileName.s, EntryNameVS.s, psFileName.s, EntryNamePS.s, videottype.l, *constantshaderFnt.l, *materialshaderFnt.l )
iCreateShader.l(vsFileName.s, psFileName.s, videottype.l, *constantshaderFnt.l, *materialshaderFnt.l)

iBasicRenderStatesMaterialServices(*services.IMaterialServices, *material.IMaterial, *lastMaterial.IMaterial,   resetAllRenderstates.b  )
iPixelShaderConstantMaterialServices(*services.IMaterialServices,		*fData.f,  startRegister.l,   constantAmount.l=1  )
iPixelShaderConstantNMaterialServices(*services.IMaterialServices,	name.s,  *float.f,   count.l)
iVertexShaderConstantMaterialServices(*services.IMaterialServices,	*fData.f,  startRegister.l,   constantAmount.l=1  )
iVertexShaderConstantNMaterialServices(*services.IMaterialServices, name.s,  *float.f,   count.l)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- PHYSIC 
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

iFreePhysic()
iInitPhysic()
iUpdatePhysic(timer.f=60.0)
iSetWorldSize(minx.f, miny.f, minz.f, maxx.f, maxy.f, maxz.f)
iGravityForce(x.f, y.f, z.f)
iSetCollideForm(form.l=1)
iTimerUpdatePhysic(timer.f = 60.0)
; rigid body
iCreateBody.l(*ent.IMesh, dynamique.b=#True, vx.f=0, vy.f=0, vz.f=0, mass.f=1.0)
iCreateTerrainBody.l(*terrain.ITerrain)
iBodyRestoreCallbacks(*ebody.IBodySceneNode) 
iFreeBody(*ebody.IBodySceneNode)
;iCoriolisForcesModeBody(*ebody.IBodySceneNode, value.b) 
iMatrixBody(*ebody.IBodySceneNode, *mat.f)
iMomentOfInertiaBody(*ebody.IBodySceneNode, x.f, y.f, z.f) 
;iAutoFreezeBody(*ebody.IBodySceneNode,  value.b)
iMassCenterBody(*ebody.IBodySceneNode, x.f, y.f, z.f)
iBodyCentreOfMass(*ebody.IBodySceneNode, *mass_center.f) 
iMassBody(*ebody.IBodySceneNode,  mass.f)
iLinearDampingBody(*ebody.IBodySceneNode, value.f)
iBodyMomentOfInertia(*ebody.IBodySceneNode, *res.f) 
;iFreezeBody(*ebody.IBodySceneNode,  value.b)
iBodyMass.f(*ebody.IBodySceneNode)
iAddForceBody(*ebody.IBodySceneNode, x.f, y.f, z.f)
iForceBody(*ebody.IBodySceneNode, x.f, y.f, z.f)
iAddDirectForceBody(*body.l, x.f, y.f, z.f)
iDirectForceBody(*body.l, x.f, y.f, z.f)
iAddForceContinuousBody(*ebody.IBodySceneNode, x.f, y.f, z.f) 
iAddTorqueBody(*ebody.IBodySceneNode, x.f, y.f, z.f)
iTorqueBody(*ebody.IBodySceneNode, x.f, y.f, z.f)
iOmegaBody(*ebody.IBodySceneNode, x.f, y.f, z.f) 
iVelocityBody(*ebody.IBodySceneNode, x.f, y.f, z.f) 
iCalculateMomentOfInertiaBody(*ebody.IBodySceneNode) 
iPositionBody(*ebody.IBodySceneNode, posx.f, posy.f, posz.f) 
iBodyX.f(*ebody.IBodySceneNode) 
iBodyY.f(*ebody.IBodySceneNode) 
iBodyZ.f(*ebody.IBodySceneNode) 
iTranslateBody(*ebody.IBodySceneNode, posx.f, posy.f, posz.f) 
iRotateBody(*ebody.IBodySceneNode, rotx.f, roty.f, rotz.f) 
iBodyOmega(*ebody.IBodySceneNode, *omega.f) 
iAngularDampingBody(*ebody.IBodySceneNode, x.f, y.f, z.f)
iBodyVelocity(*ebody.IBodySceneNode, *velocity.f) 
iContinuousCollisionModeBody(*ebody.IBodySceneNode,  value.b) 
iBodyContinuousCollisionMode.l(*ebody.IBodySceneNode) 
iBodyPosition(*ebody.IBodySceneNode, *pos.f) 
iBodyRotation(*ebody.IBodySceneNode, *rot.f) 
iPulseBody(*ebody.IBodySceneNode, delta_velocityx.f, delta_velocityy.f, delta_velocityz.f, impulse_centerx.f=0,  impulse_centery.f=0,  impulse_centerz.f=0)
iCollisionBody(*ebody.IBodySceneNode, *newCollision.l) 
iBodyNode.l(*ebody.IBodySceneNode)
iApplyForceAndTorqueBody(*ebody.IBodySceneNode, *callback.l)
iBodyIBodySceneNode.l(*body.l)
iBodyCollideBody.l(*ebody.IBodySceneNode)
iBodyNumCollideBody.l(*ebody.IBodySceneNode)
iCalculateAABBBody(*ebody.IBodySceneNode, *box.AABBOX) 
iMatrixRecursiveBody(*ebody.IBodySceneNode, *matrix.f)
iJointRecursiveCollisionBody(*ebody.IBodySceneNode, state.l)
iBodySleepState.l(*ebody.IBodySceneNode)
iBodyAutoSleep.l(*ebody.IBodySceneNode)
iAutoSleepBody(*ebody.IBodySceneNode, state.l)
iBodyCollision.l(*ebody.IBodySceneNode)
iBodyJointRecursiveCollision.l(*ebody.IBodySceneNode) 
iBodyMatrix(*ebody.IBodySceneNode, *matrix.f) 
iBodyForce(*ebody.IBodySceneNode, *force.f) 
iBodyTorque(*ebody.IBodySceneNode, *torque.f) 
iBodyLinearDamping.f(*ebody.IBodySceneNode) 
iBodyAngularDamping(*ebody.IBodySceneNode, *tt.f) 
iBodyAABB(*ebody.IBodySceneNode, *p0.f, *p1.f)
; collision instruction
iCollideNodeType(*ent.IMesh,  type.l,  vx.f=0, vy.f=0, vz.f=0)
iCollideTerrainType(*terrain.ITerrain, type.l)
iNodeCollide.l(*entA.IMesh, *entB.IMesh)
iNodeCollideAll.l(*ent.IMesh)
iCollidePointDistance.l(*ent.IMesh, x.f, y.f, z.f)
iCollideRayCast.f(*ent.IMesh, x.f, y.f, z.f, dx.f, dy.f, dz.f, type.l=1)
iCollideRayCastAll.l( x.f, y.f, z.f, dx.f, dy.f, dz.f, type.l, *dist.f)
iCollidePoint(*tri.f,  index.l)
iCollideNormal(*tri.f,  index.l)
iCollideNode.l(index.l=0)
; material
iCreatePhysicMaterial.l()
iCreatePhysicMaterialPair.l( mat1.l,  mat2.l)
iElasticityPhysicMaterial(*pr.IMaterialPair , val.f)
iFrictionPhysicMaterial(*pr.IMaterialPair, valstatic.f,  valdynamic.f)
iSoftnessPhysicMaterial(*pr.IMaterialPair,  val.f)
iGroupPhysicMaterialBody(*ebody.IBodySceneNode,  mat.l)
iBodyPhysicMaterialGroup.l(*ebody.IBodySceneNode)
iCollidablePhysicMaterial(*pr.IMaterialPair,  state.l)
iCollisionMemPhysicMaterial(*pr.IMaterialPair, flag.b=#True)
; Joints 
iFreeJoint(*joint.IJoint)
iCreateBallJoint.l(*ebody1.IBodySceneNode, *ebody2.IBodySceneNode ,  x.f,  y.f,  z.f)
iBallSetConeLimits(*ball.IJoint,  x.f,  y.f,  z.f,  maxConeAngle.f,  maxTwistAngle.f)
iCreateHingeJoint.l(*ebody1.IBodySceneNode, *ebody2.IBodySceneNode, x.f,  y.f,  z.f, dirx.f,  diry.f,  dirz.f)
iCreateSliderJoint.l(*ebody1.IBodySceneNode, *ebody2.IBodySceneNode, x.f,  y.f,  z.f, dirx.f,  diry.f,  dirz.f)
iCreateCorkScrewJoint.l(*ebody1.IBodySceneNode, *ebody2.IBodySceneNode, x.f,  y.f,  z.f, dirx.f,  diry.f,  dirz.f)
iCreateUniversalJoint.l(*ebody1.IBodySceneNode, *ebody2.IBodySceneNode, x.f,  y.f,  z.f, dirx.f,  diry.f,  dirz.f, diox.f,  dioy.f,  dioz.f)
iCreateUpVectorJoint.l(*ebody.IBodySceneNode, x.f,  y.f,  z.f)
iCreateUserJoint.l(*child.IBodySceneNode, *parent.IBodySceneNode,  maxDOF.l,  *callback.l)
iJointCollisionState.l(*joint.IJoint)
iCollisionStateJoint(*joint.IJoint,  state.l)
iJointStiffness.f(*joint.IJoint)
iStiffnessJoint(*joint.IJoint,  state.f)
iUserCallbackBallJoint(*joint.IJoint,  *callback.l)
iBallJointAngle(*joint.IJoint, *angle.f)
iBallJointOmega(*joint.IJoint, *angle.f)
iBallJointForce(*joint.IJoint, *force.f)
iUserCallbackHingeJoint(*joint.IJoint,  *callback.l)
iHingeJointAngle.f(*joint.IJoint)
iHingeJointOmega.f(*joint.IJoint)
iHingeJointForce(*joint.IJoint, *force.f)
iUserCallbackSliderJoint(*joint.IJoint,  *callback.l)
iSliderJointForce(*joint.IJoint, *force.f)
iSliderJointPosit.f(*joint.IJoint)
iSliderJointVeloc.f(*joint.IJoint)
iUserCallbackCorkscrewJoint(*joint.IJoint,  *callback.l)
iCorkscrewJointPosit.f(*joint.IJoint)
iCorkscrewJointAngle.f(*joint.IJoint)
iCorkscrewJointVeloc.f(*joint.IJoint)
iCorkscrewJointOmega.f(*joint.IJoint)
iCorkscrewJointForce(*joint.IJoint, *force.f)
iUserCallbackUniversalJoint(*joint.IJoint,  *callback.l)
iUniversalJointAngle0.f(*joint.IJoint)
iUniversalJointAngle1.f(*joint.IJoint)
iUniversalJointOmega0.f(*joint.IJoint)
iUniversalJointOmega1.f(*joint.IJoint)
iUniversalJointForce(*joint.IJoint, *force.f)
iUpVectorGetPin(*joint.IJoint, *pin.f)
iSetPinUpVector(*joint.IJoint, *pin.f)
iAddLinearRowUserJoint(*joint.IJoint, *pivot0.f, *pivot1.f, *dir.f)
iAddAngularRowUserJoint(*joint.IJoint,  relativeAngle.f,  *dir.f)
iAddGeneralRowUserJoint(*joint.IJoint,  *jacobian0.f,  *jacobian1.f)
iRowMinimumFrictionUserJoint(*joint.IJoint,  friction.f)
iRowMaximumFrictionUserJoint(*joint.IJoint,  friction.f)
iRowAccelerationUserJoint(*joint.IJoint,  acceleration.f)
iRowSpringDamperAccelerationUserJoint(*joint.IJoint,  springK.f, springD.f)
iRowStiffnessUserJoint(*joint.IJoint,  stiffness.f)
iUserJointRowForce.f(*joint.IJoint,  row.l)
; specific Newton 2.0
iFreezeBody(*ebody.IBodySceneNode,  value.b)
iPhysicThreadsCount.l()
iThreadsCountPhysic(threads.l=1)

; material inside call back
iPhysicMaterialEventCallBack(*pr.IMaterialPair, *materialCallBack.l)
iPhysicMaterialCallBackAABBOverlap(*pr.IMaterialPair, *materialCallBack.l)
iPhysicMaterialPairUserData.l(*material.IPMaterial)
iPhysicMaterialContactFaceAttribute.l(*material.IPMaterial)
iPhysicMaterialBodyCollisionID.l(*material.IPMaterial, *eBody.IBodySceneNode)
iPhysicMaterialContactNormalSpeed.f(*material.IPMaterial)
iPhysicMaterialContactForce(*material.IPMaterial, *force.f)
iPhysicMaterialContactPositionAndNormal(*material.IPMaterial, *posit.f,  *normal.f)
iPhysicMaterialContactTangentDirections(*material.IPMaterial, *dir0.f, *dir1.f)
iPhysicMaterialContactTangentSpeed.f(*material.IPMaterial,  index.l)
iContactSoftnessPhysicMaterial(*material.IPMaterial,  softness.f)
iContactElasticityPhysicMaterial(*material.IPMaterial,  restitution.f)
iContactFrictionStatePhysicMaterial(*material.IPMaterial,  state.l,  index.l)
iContactFrictionCoefPhysicMaterial(*material.IPMaterial,  staticFrictionCoef.f,  kineticFrictionCoef.f,  index.l)
iContactNormalAccelerationPhysicMaterial(*material.IPMaterial,  accel.f)
iContactNormalDirectionPhysicMaterial(*material.IPMaterial, *directionVector.f)
iContactTangentAccelerationPhysicMaterial(*material.IPMaterial,  accel.f,  index.l)
iContactRotateTangentDirectionsPhysicMaterial(*material.IPMaterial, *directionVector.f)


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- XEFFECTS Functions v1.0
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
iInitXEffect( folder.s="XShaders")
iAddShadowToNodeXEffect(*node.IMesh, filterType.l=#EFT_NONE,  shadowMode.l=#ESM_BOTH)
iRemoveShadowNodeXEffect(*node.IMesh)
iAddToNodeXEffect(*node.IMesh, EffectType.l=3)
iAmbientColorXEffect(color.l=$ffffffff)
iClearColorXEffect(color.l=$ffffffff)
iUpdateXEffect()
iAddShadowLightXEffect(x.f, y.f, z.f, tx.f=0, ty.f=0, tz.f=0, color.l=$ffffffff, nearValue.f=10.0,  farValue.f=230.0, fov.f=90.0, shadowDimen.l=512, directionnal.b=#False)
iPostProcessingUserTextureXEffect(*userTexture.ITexture)
iAddFilePostProcessingXEffect.l(filename.s)
iRemovePostProcessingXEffect( MaterialType.l)
iAddPostProcessingXEffect.l(MaterialType.l)
iAddNodeToDepthPassXEffect(*node.IMesh)
iDepthPassXEffect( flag.b = #True)
iPositionShadowLightXEffect( index.l,  x.f,  y.f,  z.f)
iTargetShadowLightXEffect( index.l, x.f,  y.f,  z.f)
iColorShadowLightXEffect( index.l,  color.l=$ffffffff)
iResolutionShadowLightXEffect( index.l,  res.l=512)
iShadowLightXEffectCount()

EndImport

                                                


; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;- PURE BASIC Function, for start
; ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Procedure.l iCreateGraphics3D(width.l, height.l, depth.l=32, fullscreen.c=#False, sync.c=#True, dType.l = #EDT_OPENGL, DepthBufferFormat.c = #True, physic.b=#True )
 
  Protected hwnd.l, res.l
  		
 ;----------------------------------------------------------
  iInitEngine()		
  ProcedureReturn iCreateScreen(dType, width, height, sync, depth, fullscreen, DepthBufferFormat, physic)
 ;----------------------------------------------------------
EndProcedure


Procedure.l iGraphics3DGadget(width.l, height.l, hwnd.l, dType.l = #EDT_OPENGL, vsync.c=#True, physic.b=#True )
    iInitEngine()
    ; ouverture de n3xt-D 
    ProcedureReturn iCreateEngineGadget(hwnd, dType, width, height, sync, physic)
EndProcedure


Procedure.l iCreateGraphics3DWin(width.l, height.l, vsync.c=#True, dType.l = #EDT_OPENGL , title.s = "N3XTD Engine",const.l= #PB_Window_SystemMenu | #PB_Window_ScreenCentered , physic.b=#True)
 
    iInitEngine()
 		
 		
   hwnd.l = OpenWindow(0, 0, 0, width, height, title, const)
   OpenWindowedScreen(WindowID(0), 0, 0, width, height, 0, 0, 0)
	 
	 *app.l = iCreateEngineGadget(hwnd, dType, width, height, sync, physic)
	 If *app = #Null
	    		End
	 EndIf

	ProcedureReturn *app
EndProcedure

Procedure.s iText(*adr)
  	Protected name$, i.l,v.c
  	i=0
  	name$=""
  	If *adr
  	  Repeat
  	   v = PeekC(*adr)
  	   ;If( v>30) 
  	      name$ = name$ + Chr(v)
  	   ; EndIf
  	    *adr+1
  	  Until v<1
    	ProcedureReturn name$
  	Else
      ProcedureReturn ""	  
  	EndIf
EndProcedure

Procedure.s NameNumeric( val.l)
  v1.l = val & $ff000000 : v1 = v1 >> 24
  v2.l = val & $00ff0000 : v2 = v2 >> 16
  v3.l = val & $0000ff00 : v3 = v3 >> 8
  v4.l = val & $000000ff
  name$ = Chr(v4)+Chr(v3)+Chr(v2)+Chr(v1)
  ProcedureReturn name$
EndProcedure
; IDE Options = PureBasic 4.40 Beta 5 (Windows - x86)
; CursorPosition = 77
; FirstLine = 74
; Folding = h